package com.uto.backend.interfaces;

import com.uto.User;
import com.uto.frontend.interfaces.IServiceListener;

interface IAppManager {
 
 	/**
 		Used when new user registers to game.
 		Send: information of new user.
 		Receive:	1: If everything ok, just get ok.
 					2: If username exists, get appropriate message
 					3: If other error, get appropriate message
 	*/
 	void register( in User user , in IServiceListener listener);
	
	/**
		Used when existing user returns to application after closing it.
		Send: information of existing user.
		Receive:	1: If user in game, data of users game and users properties (money, etc...).
					2: If user not in game, get appropriate message.
				 	3: If error, get appropriate message.
	*/
	void login(in User user , in IServiceListener listener);
	
	/**
		Used when user wants to start a new game.
		Send: Location of device
		Receive:	1: List of maps ( map = "name","list of coordinates closing the map")
					2: If error, get appropriate message.
	*/
	void getAviliableMaps(in IServiceListener listener);
	
	/**
		Used when user wants to join an existing game.
		Send: Location of device
		Receive:	1: List of games ( game = "name properties...")
					2: If error, get appropriate message.
	*/
	void getAviliableGames(in IServiceListener listener);
	
	/**
		Used when player initiates an action: Buying a street, buying houses, selling property.
		Send: current user , action properties.
		Receive:	1. If ok, ok message (and maybe new users properties).
					2. If not ok, appropriate message
	*/
	void playerAction(in String actionType , in String properties , in IServiceListener listener);



	
	
	
	/**
		Used when player want to sell street.
		Send: street for sell.
		Receive:	1. If ok, ok message street money.
					2. If not ok, appropriate message.
	*/
	void sellStreet(in String userName, in int street, in IServiceListener listener);

	
	void startNewGame(in IServiceListener listener ,in int numPlayers , in int money,in String userName);
	
	
	/**
		Get the current Game data from the DB.
	*/
    void updateGameData(in String userName ,in IServiceListener listener );
	
	/**
		Used when player want to view playerRanking.
		Receive: a Jason string with the current ranking in the following format:
				FirstName,LastName,Money, and so on... sorted by descending order. 
				(From the heights player to the looser.  
	*/
	void gameRanking(in String userName ,in IServiceListener listener);
	


	void joinGame(in IServiceListener listener , in String gameId,in String userName);

	void destroyService();
	/**
		Used when location of device is changed.
		Send: new coordinates.
		Receive:	1. If nothing special, just an ok message.
					2. If special alert (landed on someone, landed on empty street, etc), appropriate message.
	*/
	void locationChanged(in double lat , in double lng);
	
	/**
		Returns the streets owned by the user, or null if the user
		hasn't been initialized.
	*/
	String getUserStreets();
	
	/**
		Returns the amount of money the user has, or -1 if the user
		han't been initialized.
	*/
	int getUserMoney();
	
	/**
		Returns answer if we can buy the street in the given location.
	*/
	void buy(in String userName ,in double lat , in double lng , in IServiceListener listener);
	
	/**
		calling the servlet to draw the map.
	*/
	void drawMap(in String userName,in IServiceListener listener);
	

	/**
		calling the servlet to get the logs.
		of the recent actions related to the user.
	*/
	void log(in String userName,in IServiceListener listener);
	
}
